<?php

namespace App\Http\Controllers\staff;

use Illuminate\Http\Request;
use DB;
use Cookie;
use Hash;
use App\Http\Controllers\Controller;
//模型
use App\Models\Role;

class AreaController extends Controller
{
    public function getIndex(Request $request){
        $staff_id = $request -> cookie('staffInfo')['id'];
        //查询员工所负责区域
        $areaArr = DB::table('area_staff') -> where('staff_id',$staff_id) -> select('area_id') -> get();
        $areaInfo = DB::table('area') -> whereIn('id',$areaArr) -> get();
        return view('staff.area.index',['areaInfo'=>$areaInfo]);
    }
}